<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta charset="UTF-8">
		<title>首页</title>
		<script type="text/javascript" src="../jquery-3.3.1/jquery-3.3.1.min.js" ></script>
		<script type="text/javascript" src="../jquery-3.3.1/jquery-3.3.1.js" ></script>
		<link rel="stylesheet" href="../layui/css/layui.css" />
		<link rel="stylesheet" href="../css/manager_page.css" />
	
		<script src="https://img.hcharts.cn/highcharts/highcharts.js"></script>
        <script src="https://img.hcharts.cn/highcharts/modules/exporting.js"></script>
        <script src="https://img.hcharts.cn/highcharts/modules/data.js"></script>
        <script src="https://img.hcharts.cn/highcharts-plugins/highcharts-zh_CN.js"></script>
	</head>
	<body style="background: #e6e6e6;">
		<div class="layui-row">
      		<div class="layui-col-md4" id="QingJiaContainer" style="min-height: 310px;height: 400px;margin: 0 auto;"></div>
      		<div  class="layui-col-md4" id="WanGuiContainer" style="min-height: 310px;height: 400px;margin: 0 auto;"></div>
   			<div class="layui-col-md4" id="WeiGuiContainer" style="min-height: 310px;height: 400px;margin: 0 auto;"></div>
		</div>
		<div  class="layui-row">
			<div class="layui-col-md6" id="RiChangHealthInfoContainer" style="min-height: 310px;height: 400px;margin: 0 auto;"></div>
			<div class="layui-col-md6" id="DaSaoChuHealthInfoContainer" style="min-height: 310px;height: 400px;margin: 0 auto;"></div>
		</div>		
		<div class="layui-row">
			<footer class="layui-footer"style="margin-top: 10px; height: 50px;">
				
			</footer>
		</div>
		<script type="text/javascript" src="../layui/layui.js" ></script>
		<script type="text/javascript">
			getQingJiaInfo();
			getWanGuiInfo();
			getWeiGuiInfo();
			getRCHealthInfo();
			getDaSaoChuHealthInfo();
			function getQingJiaInfo(){
	  				$.ajax({
	  					type:"get",
	  					url:"../getQingJiaInfoServlet",
	  					async:true,
	  					success:function(data){
	  					//接收返回值
	  						var da = JSON.parse(data);
	  						//循环取出返回值，并将key 为 data的值包装成Array[]
	  						for(var i = 0;i < da.length;i++){
	  							var ds = new Array(1) ;
	  							ds[0] = da[i]["data"];
	  							console.log(ds);
	  							da[i]["data"] = ds;
	  						}
	  						//绘制各栋请假情况统计图			
	  					var chart = Highcharts.chart('QingJiaContainer',{
							chart: {
								type: 'column'
							},
							title: {
								text: '最近三十天各栋请假记录'
							},
							xAxis: {
								categories: ['请假']
							},
							series:da
						}); 
	  					}
	  				});
	  			}; 			
	  			function getWanGuiInfo(){
	  				$.ajax({
	  					type:"get",
	  					url:"../getWanGuiInfoServlet",
	  					async:true,
	  					success:function(data){
	  					//接收返回值
	  						var da = JSON.parse(data);
	  						//循环取出返回值，并将key 为 data的值包装成Array[]
	  						for(var i = 0;i < da.length;i++){
	  							var ds = new Array(1) ;
	  							ds[0] = da[i]["data"];
	  							console.log(ds);
	  							da[i]["data"] = ds;
	  						}
	  							//绘制各栋晚归情况统计图			
	  					var chart = Highcharts.chart('WanGuiContainer',{
							chart: {
								type: 'column'
							},
							title: {
								text: '最近三十天各栋晚归记录'
							},
							xAxis: {
								categories: ['晚归']
							},
							series:da
						}); 
	  					}
	  				});
	  			};
	  			function getWeiGuiInfo(){
	  				$.ajax({
	  					type:"get",
	  					url:"../getWeiGuiInfoServlet",
	  					async:true,
	  					success:function(data){
	  					//接收返回值
	  						var da = JSON.parse(data);
	  						//循环取出返回值，并将key 为 data的值包装成Array[]
	  						for(var i = 0;i < da.length;i++){
	  							var ds = new Array(1) ;
	  							ds[0] = da[i]["data"];
	  							console.log(ds);
	  							da[i]["data"] = ds;
	  						}
	  						//绘制各栋未归情况统计图			
	  					var chart = Highcharts.chart('WeiGuiContainer',{
							chart: {
								type: 'column'
							},
							title: {
								text: '最近三十天各栋未归记录'
							},
							xAxis: {
								categories: ['未归']
							},
							series:da
						}); 
	  					}
	  				});
	  			};
	  			
	  			function getRCHealthInfo(){
	  				$.ajax({
	  					type:"get",
	  					url:"../rcHealthInfoServlet",
	  					async:true,
	  					success:function(data){
	  					//接收返回值
	  						var da = JSON.parse(data);
	  						//循环取出返回值，并将key 为 data的值包装成Array[]
	  						for(var i = 0;i < da.length;i++){
	  							var ds = new Array(1) ;
	  							ds[0] = da[i]["data"];
	  							console.log(ds);
	  							da[i]["data"] = ds;
	  						}
	  						//绘制各栋日常卫生扣分情况情况统计图			
	  					var chart = Highcharts.chart('RiChangHealthInfoContainer',{
							chart: {
								type: 'column'
							},
							title: {
								text: '最近一周各栋日常卫生扣分情况'
							},
							xAxis: {
								categories: ['日常卫生扣分']
							},
							series:da
						}); 
	  					}
	  				});
	  			};
	  			
	  			function getDaSaoChuHealthInfo(){
	  				$.ajax({
	  					type:"get",
	  					url:"../daoSaoChuHealthInfoServlet",
	  					async:true,
	  					success:function(data){
	  					//接收返回值
	  						var da = JSON.parse(data);
	  						//循环取出返回值，并将key 为 data的值包装成Array[]
	  						for(var i = 0;i < da.length;i++){
	  							var ds = new Array(1) ;
	  							ds[0] = da[i]["data"];
	  							console.log(ds);
	  							da[i]["data"] = ds;
	  						}
	  						//绘制各栋大扫除扣分情况统计图			
	  					var chart = Highcharts.chart('DaSaoChuHealthInfoContainer',{
							chart: {
								type: 'column'
							},
							title: {
								text: '最近一周各栋大扫除扣分情况'
							},
							xAxis: {
								categories: ['大扫除扣分']
							},
							series:da
						}); 
	  					}
	  				});
	  			};
	  			
		</script>
	</body>
</html>
